package com.funning.dao;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.funning.bean.OfFuning;

public class FuningDAOImpl extends SqlMapClientDaoSupport  implements IFuningDAO{

	public int deleteFuning(long id) {
		return getSqlMapClientTemplate().delete("_Funing.deleteFuning",id);
	}

	@SuppressWarnings("unchecked")
	public List<OfFuning> getAllFuning() {
		return  getSqlMapClientTemplate().queryForList("_Funing.getAllFuning");
	}
	
	public boolean insertFuning(OfFuning funing) {
		
		getSqlMapClientTemplate().insert("_Funing.insertFunning", funing);
		return true;
		 
	}

	public int updateFuning(OfFuning funing) {
		return getSqlMapClientTemplate().update("_Funing.updateFuning", funing);
	}

	
	public OfFuning getFuningById(long id) {
		return 	(OfFuning) getSqlMapClientTemplate().queryForObject("_Funing.getFuningById", id);
	}

	public OfFuning getNewFuning() {
		
		return (OfFuning) getSqlMapClientTemplate().queryForObject("_Funing.getNewFuning");
	}

	@SuppressWarnings("unchecked")
	public List<OfFuning> getThreeFuning() {
		return getSqlMapClientTemplate().queryForList("_Funing.getthreeFuning");
	}
	
//
//	public List<OfFuning> getFuningByDesc(String ofDesc) {
//		List<OfFuning> descList=null;
//		try {
//			descList=client.queryForList("_Funing.getFuningByDesc", ofDesc);
//		} catch (SQLException e) {
//			e.printStackTrace();
//		}
//		return descList;
//	}
//
	


//	public List<OfFuning> getFuningByTime(Date time) {
//		List<OfFuning> timeList=null;
//		try {
//			timeList=client.queryForList("_Funing.getFuningByTime", time);
//		} catch (SQLException e) {
//			e.printStackTrace();
//		}
//		return timeList;
//	}

}
